public class Main {
    public int addAB(int A,int B){
        if (B == 0){
            return A;
        }
        int sum = 0;
        int carray = 0;
        while (B != 0){
            //在不考虑进位的情况下A^B=A+B
            sum = A ^ B;
            //如果进位则为1，否则为0
            carray = (A & B) <<1;
            A = sum;
            B = carray;
        }
        return A;
    }
}
